package com.ss.android.article.base.feature.f.c;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.View;

import com.bytedance.common.utility.UIUtils;
import com.ss.android.article.base.feature.f.b.b;
import java.lang.ref.WeakReference;

public abstract class a {
    public b d;
    public WeakReference e;
    public boolean f;
    public Runnable g;
    public SurfaceHolder h;
    public View i;

    public a(Context arg2, b arg3) {
        this.f = false;
        this.g = null;
        this.d = arg3;
        this.e = new WeakReference(arg2);
        this.a();
    }

    private void a() {
        Context v0 = this.d();
        if(v0 != null) {
            this.i = LayoutInflater.from(v0).inflate(com.ss.android.article.browser.R.layout.media_layout_detail_ad, null);
            UIUtils.setVisibility(this.i, 8);
            this.a(this.i);
            this.i.setOnTouchListener(new c(this));
        }
    }

    public abstract void a(View arg1);

    public boolean a(MotionEvent arg2) {
        return false;
    }

    public final View c() {
        if(this.i == null) {
            this.a();
        }
        return this.i;
    }

    public final Context d() {
        Object v0_2;
        int v0 = this.e == null || this.e.get() == null ? 0 : 1;
        if(v0 == 0) {
            v0_2 = null;
        }
        else {
            v0_2 = this.e.get();
        }

        return ((Context)v0_2);
    }
}

